import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AdminComponent } from './admin.component';
import { UserProfileComponent } from './user-profile/user-profile.component';
import { VipCourseComponent } from './vip-course/vip-course.component';
import { CourseComponent } from './user-profile/course/course.component';
import { MoneyComponent } from './user-profile/money/money.component';
import { OrderComponent } from './user-profile/order/order.component';
import { AuthGuard } from '../auth.guard';


const routes: Routes = [
  {
    path: '',
    component: AdminComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: 'user-profile', component: UserProfileComponent, children: [
          { path: 'course/:id?', component: CourseComponent },
          { path: 'money', component: MoneyComponent },
          { path: 'order', component: OrderComponent },
          { path: '', pathMatch: 'full', redirectTo: '/admin/user-profile' }
        ]
      },
      { path: 'vip-course', component: VipCourseComponent },
      { path: '', pathMatch: 'full', redirectTo: '/admin/user-profile' }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class AdminRoutingModule { }
